<%@ Page Language="C#" MasterPageFile="~/SiteUser.master" AutoEventWireup="true"
    MaintainScrollPositionOnPostback="true" CodeFile="ViewCarInsuranceNew.aspx.cs" Inherits="SiteUser_CarInsurance_ViewCarInsuranceNew" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="provider_inner">
        <h1>
            Car Insurance</h1>
        <div class="right_action">
            <asp:HyperLink runat="server" Visible="false" ID="lnkNewCarUsage" NavigateUrl="#"
                Text="New"></asp:HyperLink>
        </div>
        <fieldset>
            <dl>
                <dt class="top_action">
                    <label>
                        Commencement Date :
                    </label>
                </dt>
                <dd>
                    <asp:DropDownList ID="ddlCommenceDate" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCommenceDate_SelectedIndexChanged">
                    </asp:DropDownList>
                    Company Name :
                    <asp:DropDownList ID="ddlProviderCompany" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProviderCompany_SelectedIndexChanged">
                        <asp:ListItem Text="Liberty Insurance" Value="29" />
                        <asp:ListItem Text="Etiqa" Value="30" />
                    </asp:DropDownList>
                    Search :
                    <asp:TextBox ID="txtSearch" Text="99999999" runat="server" Width="150px" ToolTip="Search by Name or Mobile No"
                        MaxLength="50" />
                    <asp:Button ID="ibtSubmit" runat="server" Text="Submit" OnClick="ibtSubmit_Click" />
                    <asp:HyperLink ID="hplViewScript" runat="server" Target="_blank">View CI Script</asp:HyperLink>&nbsp;
                </dd>
            </dl>
        </fieldset>
        <asp:GridView ID="grvCarInsurance" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="2" EmptyDataText="There are no data records to display." CssClass="progridstyle"
            SelectedRowStyle-CssClass="progridodd" GridLines="None" OnSelectedIndexChanged="grvCarInsurance_SelectedIndexChanged"
            PagerStyle-CssClass="pgrpro" DataSourceID="sqlDsCarInsurance" DataKeyNames="RefCEUserId,CECarId, CECarPolicyId, Mobile"
            AllowSorting="True" OnPageIndexChanged="grvCarInsurance_PageIndexChanged">
            <Columns>
                <asp:BoundField DataField="RefCEUserId" Visible="false" HeaderText="RefCEUserId"
                    SortExpression="RefCEUserId" />
                <asp:BoundField DataField="CECarId" HeaderText="CarId" SortExpression="CECarId" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Mobile" HeaderText="Mobile" SortExpression="Mobile" />
                <asp:BoundField DataField="SurName" HeaderText="SurName" SortExpression="SurName" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="MakeModelDesc" HeaderText="MakeModelDesc" SortExpression="MakeModelDesc" />
                <asp:BoundField DataField="CoverageCommenceDate" HeaderText="Commencement Date" DataFormatString="{0:dd/MMM/yyyy}"
                    SortExpression="CoverageCommenceDate" />
                <asp:BoundField DataField="ModifiedDate" DataFormatString="{0:dd/MMM/yyyy hh:mm:ss tt}"
                    HeaderText="Quote Date/Time" SortExpression="ModifiedDate" />
                <asp:CommandField ShowSelectButton="True" />
            </Columns>
            <FooterStyle />
            <PagerStyle />
            <SelectedRowStyle CssClass="progridover" />
            <HeaderStyle CssClass="progridheader" />
            <EditRowStyle />
            <AlternatingRowStyle CssClass="progridodd" />
            <RowStyle CssClass="progrideven" />
        </asp:GridView>
        <asp:SqlDataSource ID="sqlDsCarInsurance" runat="server" ConnectionString="<%$ ConnectionStrings:CX_CRMDBConnectionString %>"
            SelectCommand="sprocCarInsuranceSelectUserListByCommenceDate" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="ddlCommenceDate" Name="CommenceDate" PropertyName="SelectedValue"
                    Type="String" />
                <asp:ControlParameter ControlID="ddlProviderCompany" Name="ProviderCompanyId" PropertyName="SelectedValue"
                    Type="Int64" />
                <asp:ControlParameter ControlID="txtSearch" Name="SearchKey" DefaultValue="%" PropertyName="Text"
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <div runat="server" id="divCustomerPolicyDetail" visible="false">
            <asp:Label ID="Label2" runat="server" Text="Customer And Policy Details" Font-Size="Large"
                Font-Bold="true" />
            <br />
            <br />
            <fieldset>
                <dl>
                    <dt class="top_action">
                        <label>
                        </label>
                    </dt>
                    <dd>
                        <table cellpadding="2" cellspacing="2" width="980px">
                            <tr class="progridheader">
                                <td colspan="6">
                                    <b>Customer Details</b>
                                </td>
                                <td colspan="3">
                                    <b>Car Details</b>
                                </td>
                                <td colspan="6">
                                    <b>Policy Details</b>
                                </td>
                            </tr>
                            <tr class="progrideven">
                                <td>
                                    Gender
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblGender" />
                                </td>
                                <td>
                                    Occupation
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblOccupation" />
                                </td>
                                <!--Car Detaisl-->
                                <td>
                                    Reg Year
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblRegYear" />
                                </td>
                                <!--Policy Details-->
                                <td>
                                    Applicable NCD
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblNCD" />
                                </td>
                                <td>
                                    OFD
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblOFD" />
                                </td>
                            </tr>
                            <tr class="progridodd">
                                <td>
                                    Marital Status
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblMaritalStatus" />
                                </td>
                                <td>
                                    Job Nature
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblJobNature" />
                                </td>
                                <!--Car Detaisl-->
                                <td>
                                    Offpeak
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblOffpeak" />
                                </td>
                                <!--Policy Details-->
                                <td>
                                    Current Insurer
                                </td>
                                <td>
                                    :
                                </td>
                                <td colspan="6">
                                    <asp:Label Font-Bold="true" runat="server" ID="lblCurrentInsurer" />
                                </td>
                            </tr>
                            <tr class="progrideven">
                                <td>
                                    DOB
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblDOB" />
                                </td>
                                <td>
                                    Driving In SG
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblDriveInSG" />
                                </td>
                                <!--Car Detaisl-->
                                <td>
                                    Model
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblCarMakeModel" />
                                </td>
                                <!--Policy Details-->
                                <td>
                                    Additional Drivers
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label Font-Bold="true" runat="server" ID="lblDriverCount" />
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr class="progridodd">
                                <td>Vehicle No
                                </td>
                                <td>:
                                </td>
                                <td>
                                <asp:Label Font-Bold="true" runat="server" ID="lblVehicleNo" />
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                    Claim
                                </td>
                                <td>
                                    :
                                </td>
                                <td colspan="5">
                                    <asp:Label Font-Bold="true" runat="server" ID="lblClaimInfo" />
                                </td>
                            </tr>
                        </table>
                    </dd>
                </dl>
            </fieldset>
            <asp:Label ID="Label3" runat="server" Text="Action Links" Font-Size="Large" Font-Bold="true" />
            <br />
            <br />
            <fieldset>
                <dl>
                    <dt class="top_action">
                        <label>
                        </label>
                    </dt>
                    <dd>
                        <table cellpadding="2" cellspacing="2" width="980px">
                            <tr class="progridheader">
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="3">
                                    <b>Car Insurance</b>
                                </td>
                                <td colspan="3">
                                    <b>Personal Accident</b>
                                </td>
                            </tr>
                            <tr class="progrideven">
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    <!--Car-->
                                    <asp:HyperLink ID="hplCarNewQuote" Target="_blank" runat="server" Text="NEW Customer"
                                        ToolTip="To create new quote for new customer." />
                                </td>
                                <td>
                                    <!--Car-->
                                    <asp:HyperLink ID="hplNewQuote" Target="_blank" runat="server" Text="RUN NEW Quote"
                                        ToolTip="To create new quote for selected customer." />
                                </td>
                                <td>
                                    <!--Car-->
                                    <asp:HyperLink ID="hplReRunQuote" Target="_blank" runat="server" Text="RE-RUN Quote"
                                        ToolTip="To modify car and policy details for selected customer." />
                                </td>
                                <td>
                                    <!--PA-->
                                    <asp:HyperLink ID="hplPANewUser" Target="_blank" runat="server" Text="NEW Customer"
                                        ToolTip="To create new quote for new customer." />
                                </td>
                                <td>
                                    <!--PA-->
                                    <asp:HyperLink ID="hplPANewQuote" Target="_blank" runat="server" Text="RUN NEW Quote"
                                        ToolTip="To create new quote for selected customer." />
                                </td>
                                <td>
                                    <!--PA-->
                                    <asp:HyperLink ID="hplPAViewScript" NavigateUrl="~/script/eTiQa_ePA_agents.pdf" runat="server"
                                        Target="_blank">View PA Packages</asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                    </dd>
                </dl>
            </fieldset>
            <%-- <span id="newbtn"><span class="newbutton"></span><span class="newbutton"></span><span
                class="newbutton"></span><span class="newbutton"></span><span class="newbutton">
                </span></span>
            <br />--%>
            <br />
        </div>
        <div style="display: none">
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCXCRMId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCustomerId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarPolicyId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarResultId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtServerPath" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtAgentId" />
            <asp:TextBox runat="server" ID="txtCallStatusId" Text="0"></asp:TextBox>
            <asp:TextBox runat="server" ID="txtContactNo" Text="0"></asp:TextBox>
        </div>
        <asp:Label runat="server" Text="Quotes" Font-Size="Large" Font-Bold="true" />
        <asp:HyperLink runat="server" ID="hplQuoteResultPrintPreview" Target="_blank" Text="Print Preview" />
        <br />
        <br />
        <asp:GridView ID="grvCarInsuranceCheapestQuote" runat="server" AllowPaging="True"
            AutoGenerateColumns="False" CellPadding="2" EmptyDataText="There are no data records to display."
            CssClass="progridstyle" GridLines="None" OnSelectedIndexChanged="grvCarInsurance_SelectedIndexChanged"
            DataSourceID="sqlDsCarInsuranceCheapestQuote" DataKeyNames="CITempResultId" OnRowCreated="grvCarInsuranceCheapestQuote_RowCreated"
            OnRowDataBound="grvCarInsuranceCheapestQuote_RowDataBound">
            <Columns>
                <asp:BoundField DataField="CITempResultId" Visible="false" HeaderText="CITempResultId"
                    SortExpression="CITempResultId" InsertVisible="False" ReadOnly="True" />
                <asp:BoundField DataField="RefCEUserId" Visible="false" HeaderText="RefCEUserId"
                    SortExpression="RefCEUserId" />
                <asp:BoundField DataField="CECarId" Visible="false" HeaderText="CECarId" SortExpression="CECarId" />
                <asp:BoundField DataField="ProviderCompanyId" Visible="false" HeaderText="ProviderCompanyId"
                    SortExpression="ProviderCompanyId" />
                <asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="CompanyName" />
                <asp:BoundField DataField="CXCoverTypeId" Visible="false" HeaderText="CXCoverTypeId"
                    SortExpression="CXCoverTypeId" />
                <asp:BoundField DataField="ProviderCoverTypeDesc" HeaderStyle-Width="110" HeaderText="Cover Type"
                    SortExpression="Cover Type" />
                <asp:BoundField DataField="AnnualPremium" HeaderStyle-Width="90" DataFormatString="{0:c}"
                    HeaderText="Premium" SortExpression="AnnualPremium" />
                <asp:BoundField DataField="Excess" HeaderStyle-Width="60" DataFormatString="${0:#,0}"
                    HeaderText="Excess" SortExpression="Excess" />
                <asp:BoundField DataField="PlanName" HeaderStyle-Width="90" HeaderText="Plan Name"
                    SortExpression="PlanName" />
                <asp:BoundField DataField="PolicyHolder" HeaderStyle-Width="90" DataFormatString="${0:#,0}"
                    HtmlEncode="false" HeaderText="Personal<br/>Accident<br/><span>(Insured)</span>"
                    SortExpression="PolicyHolder" />
                <asp:BoundField DataField="PassengerEach" HtmlEncode="false" DataFormatString="${0:#,0}"
                    HeaderText="Personal<br/>Accident<br/><span>(Each Passenger)</span>" SortExpression="PassengerEach" />
                <asp:BoundField DataField="MedicalExpense" HtmlEncode="false" DataFormatString="${0:#,0}"
                    HeaderText="Medical<br/>Expense" SortExpression="MedicalExpense" />
                <asp:BoundField DataField="CashAllowance" Visible="false" HeaderText="CashAllowance"
                    SortExpression="CashAllowance" />
                <asp:BoundField DataField="PersonnalEffectsLoss" DataFormatString="${0:#,0}" HtmlEncode="false"
                    HeaderText="Loss of <br/>Personal Effects" SortExpression="PersonnalEffectsLoss" />
                <asp:BoundField DataField="IsNCDInclude" HeaderText="NCD Include" SortExpression="IsNCDInclude" />
                <asp:BoundField DataField="ModifiedDate" Visible="false" HeaderText="ModifiedDate"
                    SortExpression="ModifiedDate" />
                <asp:HyperLinkField DataNavigateUrlFields="BuyUrl" HeaderText="" Text="Buy Now" Target="_blank"
                    SortExpression="BuyUrl" />
            </Columns>
            <FooterStyle />
            <PagerStyle />
            <SelectedRowStyle CssClass="progridover" />
            <HeaderStyle CssClass="progridheader" />
            <EditRowStyle />
            <AlternatingRowStyle CssClass="progridodd" />
            <RowStyle CssClass="progrideven" />
        </asp:GridView>
        <asp:SqlDataSource ID="sqlDsCarInsuranceCheapestQuote" runat="server" ConnectionString="<%$ ConnectionStrings:CX_CRMDBConnectionString %>"
            SelectCommand="sprocCarInsuranceResultSelectChepestQuote" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="txtCustomerId" Name="RefCEUserId" PropertyName="Text"
                    Type="Int64" />
                <asp:ControlParameter ControlID="txtCarId" Name="CECarId" PropertyName="Text" Type="Int64" />
                <asp:ControlParameter ControlID="txtServerPath" Name="ServerPath" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="txtAgentId" Name="AgentId" PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <br />
        <asp:UpdatePanel ID="uplCallStatus" runat="server">
            <ContentTemplate>
                <div id="divCallStatus" style="float: left;" runat="server" visible="false">
                    <asp:Label ID="Label1" runat="server" Text="Call Status" Font-Size="Large" Font-Bold="true" />
                    <table cellpadding="5" cellspacing="5" width="100%">
                        <tr>
                            <td>
                                Call For
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlCallFor" runat="server" OnSelectedIndexChanged="ddlCallFor_SelectedIndexChanged"
                                    AutoPostBack="True">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Car Insurance" Value="100" />
                                    <asp:ListItem Text="Personal Accident" Value="200" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCallFor" ValidationGroup="callstatus" runat="server"
                                    ControlToValidate="ddlCallFor" InitialValue="-1" ErrorMessage="Please select." />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Status
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlCICallStatus" Enabled="false" runat="server">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Positive" Value="1" />
                                    <asp:ListItem Text="Negative" Value="0" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCICallStatus" ValidationGroup="callstatus" runat="server"
                                    ControlToValidate="ddlCICallStatus" Display="Dynamic" InitialValue="-1" ErrorMessage="Please select." />
                                <asp:DropDownList ID="ddlPACallStatus" Visible="false" runat="server">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Positive" Value="1" />
                                    <asp:ListItem Text="Negative" Value="0" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvPACallStatus" Enabled="false" ValidationGroup="callstatus"
                                    runat="server" ControlToValidate="ddlPACallStatus" Display="Dynamic" InitialValue="-1"
                                    ErrorMessage="Please select." />
                                <asp:Label runat="server" ID="lblCallStatusMessage" Font-Bold="true" ForeColor="Red" />
                            </td>
                        </tr>
                        <asp:Panel runat="server" ID="pnlCallStatus" Visible="false">
                            <tr>
                                <td>
                                    Call Me Status
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox runat="server" TextMode="MultiLine" Height="100px" Width="700px" ID="txtCallStatus"
                                        ReadOnly="true" />
                                </td>
                            </tr>
                        </asp:Panel>
                        <tr>
                            <td>
                                Remark
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:TextBox runat="server" TextMode="MultiLine" Visible="false" Height="100px" Width="700px"
                                    ID="txtCIRemark" />
                                <asp:TextBox runat="server" TextMode="MultiLine" Visible="false" Height="100px" Width="700px"
                                    ID="txtPARemark" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                                <%--OnClientClick="javascript:return confirm('Confirm to submit?');"--%>
                                <asp:Button runat="server" Font-Bold="true" ValidationGroup="callstatus" ID="btnCallStatus"
                                    Text="Submit" OnClick="btnCallStatus_Click" Width="61px" OnClientClick="return SubmitConfirm()" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <br />
    <br />

    <script type="text/jscript">
        function SubmitConfirm() {
            var _retVal = false;
            if (Page_ClientValidate('callstatus')) {
                _retVal = confirm('Confirm to submit');
            }
            else {
                ShowDiv();
            }
            return _retVal;
        }
    </script>

</asp:Content>
